//
//  ELAnnotationView.swift
//  WZApp
//
//  Created by evol on 2018/7/13.
//  Copyright © 2018年 evol. All rights reserved.
//

import UIKit
import RxSwift

class ELAnnotationView: UIImageView {

    let disposeBag = DisposeBag()
    
    var gesture:UITapGestureRecognizer!
    
    var positon:CGPoint? {
        didSet{
            self.center = positon!
        }
    }
    
    init(_ model:ELTagModel) {
        super.init(frame: .zero)
        self.isUserInteractionEnabled = true
        self.layer.anchorPoint = CGPoint(x: 0.5, y: 1)
        
        let image = UIImage(named: "wz_tag_bg_normal")?.stretchableImage(withLeftCapWidth: 14, topCapHeight: 10)
        self.image = image
        
        let label = ELVerticalChainLabel(text: model.name, font: UIFont.systemFont(ofSize: 12), textColor: UIColor.hexColor("395522"))
        addSubview(label)
        
        self.width = 21
        self.height = CGFloat.maximum(90, label.height + 30)
        label.centerX = self.width/2
        label.centerY = self.height/2 - 3
        
        gesture = UITapGestureRecognizer()
        self.addGestureRecognizer(gesture)
    }
    

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    /*
    // Only override draw() if you perform custom drawing.
    // An empty implementation adversely affects performance during animation.
    override func draw(_ rect: CGRect) {
        // Drawing code
    }
    */

}
